import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { PageStateModel } from '../page';

@Injectable({
  providedIn: 'root',
})
export class BookService {

  constructor(
      private http: HttpClient,
  ) {
  }

  refreshData(page: PageStateModel) {
    return this.http.post(`/api/book`, page);
  }

  collect(id: number) {
    return this.http.post(`/api/book/collect?id=${id}`, null);
  }

  save(model: any) {
    return this.http.post(`/api/book/save`, model);
  }
}
